package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatEducation;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LF
 * @since 2020-08-25
 */
@Controller
@RequestMapping("/WeChatUser/wechatEducation")
public class WechatEducationController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "WechatEducation/WechateducationMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatEducationHtml")
    public String addWechatEducationHtml( ){
             return "WechatEducation/WechateducationAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatEducationHtml")
    public String editWechatEducationHtml(Integer id ,Model model ){
           model.addAttribute("wechatEducation",wechatEducationService.selectWechatEducationByIdWechatEducation(id));
             return "WechatEducation/WechateducationEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatEducationHtml")
    public String showWechatEducationHtml(Integer id ,Model model ){
           model.addAttribute("wechatEducation",wechatEducationService.selectWechatEducationByIdWechatEducation(id));
             return "WechatEducation/WechateducationShow";
    }


    /** 分页查询WechatEducation
     * @param page  页码
     * @param limit  查几条
     * @param wechatEducation  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatEducationByPage")
    @ResponseBody
    public ResultPage findWechatEducationByPage(Integer page, Integer limit,WechatEducation wechatEducation){
             return wechatEducationService.findWechatEducationByPage(page,limit,wechatEducation);
    }

    /** 添加WechatEducation
     * @param wechatEducation  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatEducation")
    @ResponseBody
    public ApiResultModel saveWechatEducation(WechatEducation wechatEducation  ){
             return wechatEducationService.addWechatEducation(wechatEducation);
    }

    /** 编辑WechatEducation
     * @param wechatEducation  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatEducation")
    @ResponseBody
    public ApiResultModel editWechatEducation(WechatEducation wechatEducation  ){
             return wechatEducationService.editWechatEducation(wechatEducation);
    }



    /** 删除一条WechatEducation
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatEducation")
    @ResponseBody
    public ApiResultModel delWechatEducation( Integer id  ){
             return wechatEducationService.delWechatEducation(id);
    }


}
